import { NestFactory } from '@nestjs/core';
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
import { AppModule } from './app.module';

async function bootstrap() {
  const app = await NestFactory.create(AppModule);

  app.enableCors();

  // 配置 swagger
  const options = new DocumentBuilder()
    .setTitle('前端api文档')
    .setDescription('本文档为前端页面的api接口')
    .setVersion('1.0')
    .build();
  const document = SwaggerModule.createDocument(app, options);
  SwaggerModule.setup('api-web', app, document);

  await app.listen(3001);

  console.log('接口文档: http://localhost:3001/api-web/#/')
}
bootstrap();
